package com.shuzu.demo2;

import java.util.Arrays;

/*
 * 
 * 数组的冒泡排序
 * 
 */
public class BubbleSortTest {
		public static void main(String[] args) {
			int[] arr = new int[]{43,32,76,-98,0,-21,32,99};
			for(int i = 0 ; i<arr.length;i++){
				for(int j = 0 ; j<arr.length-i-1;j++){
					if(arr[j] > arr[j+1]){
						int temp=0 ;
						temp = arr[j];
						arr[j] = arr[j+1] ;
						arr[j+1] = temp;
					}
				}
				
			}
			for(int i=0;i<arr.length;i++){
				System.out.print(arr[i]+"\t");
			}
			System.out.println(Arrays.toString(arr));
			
		}
}
